<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:s="http://jboss.org/seam/faces"
      xml:lang="en" lang="en">

<ui:composition template="/resources/layout.xhtml">
    <ui:define name="title">Login</ui:define>
    <ui:define name="content">
        <div class="login_form">
            <h:panelGroup rendered="#{identity.loggedIn}">
                <div class="logged_panel">
                    <p>Currently logged in as: <b>#{identity.user.id}</b></p>
                    <h:form>
                        <h:commandButton id="logout" value="Log out" action="#{identity.logout}"/>
                        <br/>
                        <h:commandLink action="item.xhtml" value="Continue to the item page" styleClass="itemPageLabel"/>
                    </h:form>
                </div>
            </h:panelGroup>
            <h:form id="loginForm" rendered="#{not identity.loggedIn}">
                <div class="loginRow">
                    <h:outputLabel for="name" value="Username" styleClass="loginLabel"/>
                    <h:inputText id="name" value="#{credentials.username}"/>
                </div>
                <div class="loginRow">
                    <h:outputLabel for="password" value="Password" styleClass="loginLabel"/>
                    <h:inputSecret id="password" value="#{credentials.password}" redisplay="true"/>
                </div>
                <div class="loginRow">
                </div>
                <div class="buttons">
                    <h:commandButton id="login" value="Login" action="#{identity.login}" styleClass="loginButton"/>
                </div>
                <div style="clear:both" />
                <h:messages globalOnly=""/>
                <!--p>Valid username password credentials are:
                    <ul>
                        <li>demo/demo</li>
                        <li>admin/admin</li>
                    </ul>
                </p-->
            </h:form>
        </div>
        <br style="clear:both"/>
    </ui:define>
</ui:composition>
</html>
